import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_project/config/theme_color.dart';
import '../common/utils/screen_size_utils.dart';
import '../generated/l10n.dart';

class CommonEmptyView extends StatelessWidget {
  final Function? refreshBlock;

  const CommonEmptyView({this.refreshBlock, Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: () {
        if (refreshBlock != null) {
          refreshBlock!();
        }
      },
      child: Center(
        child: Column(
          children: [
            const SizedBox(
              height: 139,
            ),
            Image.asset(
              'assets/images/empty_place_bg.png',
              width: ScreenSizeUtils.deviceScreenWidth(context) / 2.0,
            ),
            const SizedBox(
              height: 20,
            ),
            Container(
              decoration: BoxDecoration(
                  borderRadius: BorderRadius.circular(20),
                  border: Border.all(color: ThemeColor.mainColor, width: 1.0)),
              padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 12),
              child: Text(
                S.of(context).noDataAndClickRefresh,
                style:
                    TextStyle(color: ThemeColor.grayA0A0A0Color, fontSize: 16),
              ),
            ),
          ],
        ),
      ),
    );
  }
}
